#include <QtGui>
#include <QtWebKit>
#include "popup.h"
#include <QDebug>

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    Popup pop;
    pop.setWindowIcon(QIcon(":/images/weboob.png"));
    pop.setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
    pop.adjustSize();
    //pop.setWebViewLocation("http://127.0.0.1/weboob-installer/getapplication.php?id=WEBOOBWEBOOBWEBOOBWEBOOBWEBOOBWEBOOB1234");

    for (int i = 0; i < argc; i++){
        if (i + 1 != argc){
            if (QString(argv[i]) == "-web"){
                pop.setWebViewLocation(QString(argv[i + 1]));
            }
            else if (QString(argv[i]) == "-firststart"){
                pop.setWebViewLocation("http://127.0.0.1/weboob-installer/getapplication.php?id=" + QString(argv[i + 1]));
            }
        }
    }

    if (!QSystemTrayIcon::isSystemTrayAvailable()){
        return 1;
    }

    return app.exec();
}
